import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class PwdTextField extends StatefulWidget {
  const PwdTextField({super.key});

  @override
  State<PwdTextField> createState() => _PwdTextFieldState();
}

class _PwdTextFieldState extends State<PwdTextField> {

  bool obscureText = true;



  @override
  Widget build(BuildContext context) {
    return Container(
        margin: EdgeInsets.only(top: 8),
        decoration: BoxDecoration(
            border: Border.all(
              color: Color(0xFFD8E0F0),
            ),
            borderRadius: BorderRadius.circular(14)),
        child: Stack(
          children: [
            TextField(
              obscureText: obscureText,
              decoration: InputDecoration(
                  border: InputBorder.none,
                  hintText: "请输入密码",
                  hintStyle: TextStyle(
                      color: Color(0xFF7D8592),
                      fontWeight: FontWeight.w400,
                      fontSize: 14)
                      ,
                  contentPadding:
                  EdgeInsets.symmetric(horizontal: 10)),
            ),
            Positioned(
                bottom: 12,
                right: 12,
                child: InkWell(
                  onTap: (){
                    setState(() {
                      obscureText = !obscureText;
                    });
                  },
                  child: MouseRegion(
                    cursor: SystemMouseCursors.click,
                    child: Container(
                      child: Image.asset(
                        "images/eye.png",
                        width: 24.w,
                      ),
                    ),
                  ),
                ))
          ],
        ));
  }
}
